package com.aurora.app.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.aurora.base.entity.BaseEntity;
/**
 * 记录微信用户的code,access_token,refresh_token
 * @author yongjiang.lin
 *
 */
@Entity
@Table(name = "tb_weixin_user_Token")
public class WeixinUserToken extends BaseEntity {
	
	private String code ;
	private Date getCodeTime;
	private String accessToken;
	private Date getAccessTokenTime;
	private String refreshToken;
	private Date getRefreshTokenTime;
	private User user;
	
	@Column(name="f_code")
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "f_get_code_time")
	public Date getGetCodeTime() {
		return getCodeTime;
	}
	public void setGetCodeTime(Date getCodeTime) {
		this.getCodeTime = getCodeTime;
	}
	@Column(name="f_accessToken")
	public String getAccessToken() {
		return accessToken;
	}
	public void setAccessToken(String accessToken) {
		this.accessToken = accessToken;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "f_get_access_token_time")
	public Date getGetAccessTokenTime() {
		return getAccessTokenTime;
	}
	public void setGetAccessTokenTime(Date getAccessTokenTime) {
		this.getAccessTokenTime = getAccessTokenTime;
	}
	@Column(name="f_refreshToken")
	public String getRefreshToken() {
		return refreshToken;
	}
	public void setRefreshToken(String refreshToken) {
		this.refreshToken = refreshToken;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "f_get_refreshToken_time")
	public Date getGetRefreshTokenTime() {
		return getRefreshTokenTime;
	}
	public void setGetRefreshTokenTime(Date getRefreshTokenTime) {
		this.getRefreshTokenTime = getRefreshTokenTime;
	}
	
	@ManyToOne(cascade = {CascadeType.REFRESH}, optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "f_user_id")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
}
